module Ui.Icons exposing (..)

{-| This module contains icons for the components.

# Icons
@docs icon, close, checkmark, chevronRight, chevronLeft, plus, search
@docs starFull, starEmpty, backspace, calendar
-}

import Svg.Attributes exposing (d, width, height, viewBox)
import Svg exposing (svg, path)
import Html

{-| Calendar icon.
-}
calendar : List (Html.Attribute msg) -> Html.Html msg
calendar =
  icon
    """
    M9 0C7.578 0 6.428 1.15 6.428 2.572v2.57c0 1.423 1.15 2.573 2.572 2.573
    1.422 0 2.572-1.15 2.572-2.572v-2.57C11.572 1.15 10.422 0 9 0zm18 0c-1.422
    0-2.572 1.15-2.572 2.572v2.57c0 1.423 1.15 2.573 2.572 2.573 1.422 0
    2.572-1.15 2.572-2.572v-2.57C29.572 1.15 28.422 0 27 0zM.643 2.572c-.354
    0-.643.29-.643.643v32.142c0 .354.29.643.643.643h34.714c.354 0
    .643-.29.643-.643V3.215c0-.354-.29-.643-.643-.643h-4.5v3.27C30.857 7.65
    28.993 9 27.064 9c-1.928 0-3.92-1.35-3.92-3.158v-3.27H12.856v3.27C12.857
    7.65 10.93 9 9 9 7.07 9 5.143 7.65 5.143 5.842v-3.27h-4.5zm3.214
    9h28.286v20.57H3.857v-20.57z
    """


{-| Empty star icon.
-}
starEmpty : List (Html.Attribute msg) -> Html.Html msg
starEmpty =
  icon
    """
    M36 13.937l-12.945-1.11L18 .89l-5.056 11.936L0 13.936l9.82 8.513-2.944
    12.66L18 28.397l11.123 6.71L26.18 22.45 36 13.937zm-16.527 12.02L18
    25.066l-1.473.89-5.345 3.224 1.415-6.085.39-1.674-1.3-1.125L6.965
    16.2l6.223-.533 1.71-.147.67-1.582L18 8.2l2.43 5.738.67 1.582 1.712.147
    6.223.534-4.722 4.095-1.3 1.126.39 1.675 1.415 6.086-5.345-3.224z
    """


{-| Full star icon.
-}
starFull : List (Html.Attribute msg) -> Html.Html msg
starFull =
  icon
    """
    M23.055 12.826L18 .89l-5.056 11.936L0 13.936l9.82 8.514-2.944 12.66L18
    28.397l11.123 6.71L26.18 22.45 36 13.937
    """


{-| Search icon.
-}
search : List (Html.Attribute msg) -> Html.Html msg
search =
  icon
    """
    M35.72 30.245l-7.95-8.05c1.293-2.26 1.968-4.77 1.968-7.302C29.738
    6.683 23.063 0 14.868 0 6.676 0 0 6.683 0 14.893s6.675 14.893 14.87
    14.893c2.614 0 5.202-.722 7.508-2.1l7.913
    8.023c.18.178.432.29.685.29.253 0
    .506-.103.684-.29l4.06-4.106c.374-.384.374-.984 0-1.36zM14.87
    5.802c5.005 0 9.074 4.077 9.074 9.09 0 5.015-4.07 9.092-9.075
    9.092-5.008 0-9.076-4.077-9.076-9.09 0-5.015 4.068-9.092 9.075-9.092z
    """


{-| Plus icon.
-}
plus : List (Html.Attribute msg) -> Html.Html msg
plus =
  icon "M0 21h15v15h6V21h15v-6H21V0h-6v15H0"


{-| Close icon.
-}
close : List (Html.Attribute msg) -> Html.Html msg
close =
  icon
    """
    M35.592 30.256l-12.3-12.34L35.62 5.736c.507-.507.507-1.332
    0-1.838L32.114.375C31.87.13 31.542 0 31.194 0c-.346
    0-.674.14-.917.375L18.005 12.518 5.715.384C5.47.14 5.14.01
    4.794.01c-.347 0-.675.14-.918.374L.38 3.907c-.507.506-.507
    1.33 0 1.837l12.328 12.18L.418 30.257c-.245.244-.385.572-.385.918
    0 .347.13.675.384.92l3.506 3.522c.254.253.582.384.92.384.327 0
    .665-.122.918-.384l12.245-12.294 12.253
    12.284c.253.253.58.385.92.385.327 0
    .664-.12.917-.384l3.507-3.523c.243-.243.384-.57.384-.918-.01-.337-.15-.665-.394-.91z
    """


{-| Right chevron icon.
-}
chevronRight : List (Html.Attribute msg) -> Html.Html msg
chevronRight =
  icon
    """
    M21.403 17.996L7.963 4c-.34-.345-.33-.916.015-1.27L10.382.27c.345-.353.908-.36
    1.246-.016l16.415 17.1c.177.176.257.417.24.65.01.24-.07.474-.24.65L11.628
    35.747c-.338.345-.9.337-1.246-.016l-2.404-2.46c-.346-.354-.354-.925-.016-1.27l13.44-14.004z
    """


{-| Left chevron icon.
-}
chevronLeft : List (Html.Attribute msg) -> Html.Html msg
chevronLeft =
  icon
    """
    M14.597 17.996L28.037
    4c.34-.345.33-.916-.015-1.27L25.618.27c-.345-.353-.908-.36-1.246-.016L7.957
    17.344c-.177.178-.257.42-.24.652-.01.24.07.474.24.65l16.415
    17.1c.338.345.9.337 1.246-.016l2.404-2.46c.346-.354.354-.925.016-1.27l-13.44-14.004z
    """


{-| Checkmark icon.
-}
checkmark : List (Html.Attribute msg) -> Html.Html msg
checkmark =
  icon
    """
    M35.792 5.332L31.04 1.584c-.147-.12-.33-.208-.537-.208-.207
    0-.398.087-.545.217l-17.286 22.21S5.877 17.27 5.687
    17.08c-.19-.19-.442-.51-.822-.51-.38 0-.554.268-.753.467-.148.156-2.57
    2.7-3.766 3.964-.07.077-.112.12-.173.18-.104.148-.173.313-.173.494 0
    .19.07.347.173.494l.242.225s12.058 11.582 12.257 11.78c.2.2.442.45.797.45.345
    0 .63-.37.795-.536l21.562-27.7c.104-.146.173-.31.173-.5 0-.217-.087-.4-.208-.555z
    """


{-| Base for all icons.
-}
icon : String -> List (Html.Attribute msg) -> Html.Html msg
icon iconPath attributes =
  svg
    ([ width "36", height "36", viewBox "0 0 36 36" ] ++ attributes)
    [ path [ d iconPath ] [] ]


{-| Backspace icon.
-}
backspace : List (Html.Attribute msg) -> Html.Html msg
backspace =
  icon
    """
    M35.082 6.578c-.626-.626-1.424-.953-2.325-.953H11.813c-1.71
    0-3.074.66-4.058 2L0 17.995 7.763 28.3l.012.017.013.016c.486.624 1.014
    1.105 1.617 1.437.712.392 1.522.608 2.407.608h20.954c1.84 0 3.234-1.565
    3.234-3.445v-18c0-.902-.292-1.726-.918-2.352zM29.07
    23.365c.108.107.167.25.167.402 0 .15-.06.295-.167.4l-1.534
    1.54c-.11.113-.255.168-.4.168-.146 0-.29-.055-.4-.167l-5.36-5.376-5.36
    5.376c-.11.112-.256.167-.4.167-.146
    0-.29-.055-.4-.167l-1.536-1.54c-.107-.106-.167-.25-.167-.4
    0-.152.06-.296.167-.403L19.062 18l-5.396-5.365c-.22-.22-.22-.58
    0-.803l1.533-1.54c.106-.108.25-.167.4-.167.15 0 .294.06.4.166l5.375 5.312
    5.375-5.31c.106-.108.25-.167.4-.167.15 0 .294.06.4.166l1.534
    1.542c.222.222.222.582 0 .803L23.69 18l5.38 5.365z
    """
